package com.tcmj.dining.utils;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class SysUtils {

	/**
	 * 9--16点
	 * @return
	 */
	public static boolean isTimeRange() {
		Calendar nowTime = Calendar.getInstance();
		Calendar beginTime = Calendar.getInstance();
		Calendar endTime = Calendar.getInstance();
		try{
			SimpleDateFormat df = new SimpleDateFormat("HH:mm");
		    Date now = df.parse(df.format(new Date()));
		    Date begin = df.parse("9:00");
		    Date end = df.parse("16:00");
		    nowTime.setTime(now);
		    beginTime.setTime(begin);
		    endTime.setTime(end);
		}catch(Exception e){
			e.printStackTrace();
		}
		if (nowTime.before(endTime) && nowTime.after(beginTime)) {
	        return true;
	    } else {
	        return false;
	    }
	}
}
